﻿// Copyright 2005, 2006 - Morten Nielsen (www.iter.dk)
//
// This file is part of SharpMap.
// SharpMap is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// SharpMap is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.

// You should have received a copy of the GNU Lesser General Public License
// along with SharpMap; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 

using System;
using System.Runtime.Serialization;
using System.Collections.Generic;
using System.Text;

namespace Petra.Gis.ReferenceSystemServices
{
  /// <summary>
  /// A set of quantities from which other quantities are calculated.
  /// </summary>
  /// <remarks>
  /// For the OGC abstract model, it can be defined as a set of real points on the earth 
  /// that have coordinates. EG. A datum can be thought of as a set of parameters 
  /// defining completely the origin and orientation of a coordinate system with respect 
  /// to the earth. A textual description and/or a set of parameters describing the 
  /// relationship of a coordinate system to some predefined physical locations (such 
  /// as center of mass) and physical directions (such as axis of spin). The definition 
  /// of the datum may also include the temporal behavior (such as the rate of change of
  /// the orientation of the coordinate axes).
  /// </remarks>
  [DataContract(Name="DATUM")]
  public abstract class Datum
  {

    /// <summary>
    /// xaml constr
    /// </summary>
    protected Datum() { }




    /// <summary>
    /// Initializes a new instance of a Datum object
    /// </summary>
    /// <param name="metadata">object metadata</param>
    protected Datum(Metadata metadata)
    {
      Metadata = metadata;
    }




    //private Metadata _metadata;
    [DataMember(Name="INFO")]
    public Metadata Metadata
    { get; set; }


    #region public Members


    /// <summary>
    /// Checks whether the values of this instance is equal to the values of another instance.
    /// Only parameters used for coordinate system are used for comparison.
    /// Name, abbreviation, authority, alias and remarks are ignored in the comparison.
    /// </summary>
    /// <param name="obj"></param>
    /// <returns>True if equal</returns>
    public virtual bool EqualParams(object obj)
    {
      if (!(obj is Spheroid))
        return false;
      return (obj as Datum).Metadata.Name == this.Metadata.Name;
    }

    
    #endregion

  }
}
